<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="com.erp.hibernate.beans.Employee" %>
<%@ page import="java.util.*" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<link href="main.css" rel="stylesheet" type="text/css"/>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<script>
    function check(){
       if(confirm("你确定要提交该出库记录吗？")){
          if (document.getElementById("quantity").value==""||!/^[1-9]\d*$/.test(document.getElementById("quantity").value)){
                alert("请输入正确的入库数量！");
              	return false;               
          }
       }
    }
    function find(){
        if (document.all.findbutton.value=="重填"){
            document.all.findbutton.value="查找"
            document.all.goodsId.readOnly=false;
            document.all.outbutton.disabled=true;
       }else{
         if (document.all.goodsId.value==""){
             alert("请输入物品编号！");
             return;
         }
         document.all.form.action="search!findbill.do?dir=outbill";
         document.all.form.submit();
       }     
    }
</script>
	<body>
		<%
			Date nowdate=new Date();
			SimpleDateFormat ss=new SimpleDateFormat("yyyy-MM-dd");
			String orderdate=ss.format(nowdate);
			Employee em=(Employee)session.getAttribute("employee");
		%>
	    <form action="outbill!insert.do" name="form" method="post">
		<table class="tableborder" cellspacing="1" cellpadding="4" width="98%" align="center">
			<colgroup align="left">
				<col class="altbg1" width="20%"/>							
				<col class="altbg2" width="30%"/>
				<col class="altbg1" width="20%"/>
				<col class="altbg2" width="30%"/>
			</colgroup>
			<tr>
			   <td colspan="4" class="header">新增出库单<input type="hidden" name="outbill.goodsid" value="<s:property value="inbill.goodsid"/>"/></td>
			</tr>
			<tr>
				<td><font color="red">*</font>物品编号：</td>
				<td><input name="goodsId" type="text" maxlength="40"/><input type="button" name="findbutton" value="查找" onclick="find();"/></td>
				<td>出库人员：</td>
				<td><span><%=em.getName()%></span></td>
			</tr>
			<tr>
				<td>出库单号码：</td>
				<td colspan="3"><input type="text" name="outbill.billid" /></td>
			</tr>
			<tr>
				<td>物品名称：</td>
				<td><input type="text" name="outbill.goodsname" value="<s:property value="inbill.goodsname"/>" readonly="readonly" /></td>
				<td>出库日期：</td>
				<td><span><%=orderdate%></span></td>
			</tr>
			<tr>
				<td>牌号：</td>
				<td><input type="text" name="outbill.trademark" value="<s:property value="inbill.trademark"/>" readonly="readonly" /></td>
				<td>库房编号：</td>
				<td><input type="text" name="outbill.depottype" value="<s:property value="inbill.depottype"/>" readonly="readonly" /></td>
			</tr>
			<tr>
				<td>规格：</td>
				<td><input type="text" name="outbill.spec" value="<s:property value="inbill.spec"/>" readonly="readonly" /></td>
				<td><font color="red">*</font>出库数量：</td>
				<td><input type="text" id="quantity" name="outbill.quanlity" maxlength="10"/></td>
			</tr>
			<tr>
				<td colspan="4" bgcolor="d6e0ef" align="center"><input type="submit"  value="出库" onclick="return check();"/></td>
			</tr>
      </table>
      </form>
	</body>
</html>

